********************************************************************************
*********			  		FIG 5 Panel B - EVOLUTION OVER TIME 		********
*********								OF TOLL PER MILE BY HOUR      	********
********************************************************************************


	use ".\data\clean\I10_feb_dec_dataclean_14aug2015.dta", clear
	g dow = dow(entry_date)
	drop if dow==0 | dow==6
	g holiday=0
	g date=entry_date
	*NY
	replace holiday=1 if date==td(01jan2013) | date==td(01jan2012) | date==td(31dec2012) | date==td(31dec2011)
	*MLK
	replace holiday=1 if date==td(21jan2013) | date==td(16jan2012)
	*President's Day
	replace holiday=1 if date==td(20feb2012) | date==td(18feb2013)
	* Easter week
	replace holiday=1 if date >= td(2apr2012) & date <= td(8apr2012)
	replace holiday=1 if date >= td(26mar2013) & date <= td(31mar2013)
	*Memorial Day
	replace holiday=1 if date==td(28may2012) | date==td(27may2013)
	*4th of July
	replace holiday=1 if date==td(04jul2012) | date==td(04jul2013)
	* Labor Day
	replace holiday=1 if date==td(03sep2012) | date==td(05sep2011) | date==td(02sep2013)
	* Columbus Day
	replace holiday=1 if date==td(08oct2012) | date==td(10oct2011) | date==td(14oct2013)
	* Veteran's Day
	replace holiday=1 if date==td(11nov2012) | date==td(11nov2011) | date==td(11nov2013)
	* Thanksgiving week
	replace holiday=1 if date >= td(22nov2011) & date <= td(26nov2011)
	replace holiday=1 if date >= td(19nov2012) & date <= td(23nov2012)
	replace holiday=1 if date >= td(25nov2013) & date <= td(30nov2013)
	* Christmas week
	replace holiday=1 if date >= td(24dec2011) & date <= td(31dec2011)
	replace holiday=1 if date >= td(24dec2012) & date <= td(31dec2012)
	replace holiday=1 if date >= td(24dec2013) & date <= td(31dec2013)
	drop if holiday==1
	g entry_pm=cond(entry_plaza=="WT01",27.84 , ///
			cond(entry_plaza=="WT02",25.29 , ///
			cond(entry_plaza=="WT03",24.32 , ///
			cond(entry_plaza=="WT04",21.62 , ///
			cond(entry_plaza=="WT05", 21.26, ///
			cond(entry_plaza=="WT06", 18.16,.))))))		
	g exit_pm=cond(exit_plaza=="WT01",27.84 , ///
			cond(exit_plaza=="WT02",25.29 , ///
			cond(exit_plaza=="WT03",24.32 , ///
			cond(exit_plaza=="WT04",21.62 , ///
			cond(exit_plaza=="WT05", 21.26, ///
			cond(exit_plaza=="WT06", 18.16,.))))))	
	g dist=entry_pm-exit_pm
	g tollpermi=charged_toll/dist
	g monthgroup=cond(date<td(04apr2013),1, ///
		cond(entry_month==5,2, ///
			cond(entry_month==8,3,.)))
	collapse tollpermi if charged_toll!=0 & entry_hour>4 & entry_hour<10, by(monthgroup entry_hour) 

	twoway (line tollpermi entry_hour if monthgroup==1, lc(black) lp(solid) lw(medthick)) ///
		(line tollpermi entry_hour if monthgroup==2, lc(black) lp(dash) lw(medthick)) ///
		(line tollpermi entry_hour if monthgroup==3, lc(black) lp(dot) ) , ///
		xtitle("") ytitle("Average Toll per Mile in Dollars") legend(label(1 "First Month") label(2 "Third Month") label(3 "Sixth Month") ring(0) position(11) rows(4) cols(1) region(lc(black))) ///
		xlabel( 5 "5 AM" 6 "6 AM" 7 "7 AM" 8 "8 AM" 9 "9 AM") ylabel(,format(%03.1f))
	graph export ".\results\maintablesfigs\figs\fig5pb.png", width(2550) replace
  putexcel set ".\results\maintablesfigs\figs.xlsx", sheet("Figure 5 Panel B") modify
  putexcel A1 = picture(".\results\maintablesfigs\figs\fig5pb.png")
